package com.ycsd.invest.order.business.listplugin;

import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.plugin.PreparePropertysEventArgs;
import kd.bos.form.ConfirmCallBackListener;
import kd.bos.form.FormShowParameter;
import kd.bos.form.MessageBoxOptions;
import kd.bos.form.ShowType;
import kd.bos.form.container.Tab;
import kd.bos.form.control.events.BeforeItemClickEvent;
import kd.bos.form.events.BeforeCreateListColumnsArgs;
import kd.bos.form.events.BeforeCreateListDataProviderArgs;
import kd.bos.form.events.HyperLinkClickArgs;
import kd.bos.form.events.SetFilterEvent;
import kd.bos.form.field.BasedataEdit;
import kd.bos.form.plugin.AbstractFormPlugin;
import kd.bos.list.events.ListRowClickListener;
import kd.bos.mvc.list.ListDataProvider;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.QueryServiceHelper;
import kd.epm.eb.formplugin.AbstractListPlugin;

import java.util.EventObject;

public class TestListTabPlugin extends AbstractListPlugin implements ListRowClickListener {

    /**
     * 在此事件，可以侦听各个控件的插件事件。
     *
     * 说明：控件必须在registerListener方法中进行注册之后才会执行控件的事件。
     * 比如页面中有一个按钮控件，需要先在registerListener方法中添加该按钮控件，
     * 点击按钮时才会执行click、beforeClick等方法，否则不会执行，按钮控件相关事件请参考按钮控件 (kingdee.com)。其他控件同理。
     * @param e
     */
    @Override
    public void registerListener(EventObject e) {
//        this.addItemClickListeners("tbldel");
    }

    //工具栏单击
    @Override
    public void beforeItemClick(BeforeItemClickEvent evt) {
        String itemKey = evt.getItemKey();
        //获取选中数据
//        getSelectedRows()
        switch (itemKey) {
            case "tbldel" : {

//                evt.setCancel(true);
                //查询
//                DynamicObject dynamicObject = BusinessDataServiceHelper
//                        .loadSingle(dataEntity.getString("id"), "ycsd_study_form");
//                DynamicObjectCollection dynamicObjects = QueryServiceHelper.query("ycsd_study_form",
//                        "id,billno,billstatus,languages",
//                        new QFilter[]{new QFilter("id", QCP.equals, dataEntity.getString("id"))});
//                this.getView().showConfirm("确认删除？", MessageBoxOptions.YesNo, new ConfirmCallBackListener("del"));
                break;
            }
            default: break;
        }
    }
}
